// pages/personal/myPromote/usersRecom/usersRecom.js
var app = getApp();
var api = require('../../../../utils/api')
var apis = api.api
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		btnData: [{
				id: 0,
				title: '昨天',
			},
			{
				id: 1,
				title: '近七日',
			},
			{
				id: 2,
				title: '全部',
			},
		],
		num: 0,
		one: true,
		two: false,
		three: false,
		userData: {}, //用户的信息
		isHas: false, //判断数据是否为空
		content: [{
				id: 0,
				name: '张三',
				url: 'https://cdn.oss.dgddaijia.com/icons/persons.png',
				price: '0.00'
			},
			{
				id: 1,
				name: '张三',
				url: 'https://cdn.oss.dgddaijia.com/icons/persons.png',
				price: '0.00'
			}
		],
	},
	tabBtn(e) {
		var that = this;
		that.setData({
			num: e.currentTarget.dataset.index
		})
		if (e.currentTarget.dataset.index == 0) {
			that.setData({
				one: true,
				two: false,
				three: false
			})
		} else if (e.currentTarget.dataset.index == 1) {
			that.setData({
				one: false,
				two: true,
				three: false
			})
		} else {
			that.setData({
				one: false,
				two: false,
				three: true
			})
		}
	},
	/**
	 * 生命周期函数--监听页面加载
	 */
	getData() {
		//获取推荐信息
		let that = this;
		let url = apis.host + 'user/getChildres';
		let data = {};
		apis.request(url, data, 'POST').then(function(res) {
			if (res.code == 200) {
				let isHas = false;
				if (JSON.stringify(res.data) === '{}') {
					isHas: true
				}
				that.setData({
					userData: res.data,
				})
			}
		})
	},
	onLoad: function(options) {
		this.getData()
	},
})
